package o;

import android.content.Context;
import android.os.RemoteException;
import com.huawei.appgallery.downloadengine.api.SessionDownloadTask;
import com.huawei.appmarket.framework.coreservice.BaseIPCResponse;
import com.huawei.appmarket.framework.coreservice.DataHolder;
import com.huawei.appmarket.framework.coreservice.Status;
import com.huawei.appmarket.service.deamon.bean.DownloadHistory;
import com.huawei.appmarket.service.externalservice.distribution.download.request.QueryTaskIPCRequest;
import com.huawei.appmarket.service.externalservice.distribution.download.response.QueryTaskResponse;
import com.huawei.appmarket.service.externalservice.distribution.download.response.TaskInfo;
import java.util.HashMap;
import java.util.LinkedHashMap;

public class dzc implements dhe<QueryTaskIPCRequest, QueryTaskResponse> {
    public void ˊ(Context context, DataHolder<QueryTaskIPCRequest> dataHolder, dgz o_dgz) throws RemoteException {
        ॱ(dataHolder);
        BaseIPCResponse ॱ = ॱ();
        HashMap hashMap = new HashMap();
        String ˋ = dataHolder.ˏ().ˋ();
        String ˏ = dataHolder.ˏ().ˏ();
        for (SessionDownloadTask sessionDownloadTask : dvt.ˏ().ͺ()) {
            String ॱˎ = sessionDownloadTask.ॱˎ("mediaPkg");
            String ॱˎ2 = sessionDownloadTask.ॱˎ("callerPkg");
            if (ˋ.equals(ॱˎ) || ˏ.equals(ॱˎ2)) {
                TaskInfo taskInfo = new TaskInfo();
                taskInfo.ˏ(2);
                taskInfo.ॱ(sessionDownloadTask.ˈ());
                taskInfo.ˎ(sessionDownloadTask.ʼॱ());
                hashMap.put(sessionDownloadTask.ˊˊ(), taskInfo);
            }
        }
        for (DownloadHistory downloadHistory : dsv.ˊ()) {
            String ॱ2 = downloadHistory.ॱ("mediaPkg");
            ॱˎ2 = downloadHistory.ॱ("callerPkg");
            if (ˋ.equals(ॱ2) || ˏ.equals(ॱˎ2)) {
                TaskInfo taskInfo2 = new TaskInfo();
                int ˋ2 = ((cdg) cdb.ॱ(cdg.class)).ˋ(downloadHistory.ˋ());
                if (ˋ2 == 2 || ˋ2 == 1) {
                    taskInfo2.ˏ(2);
                    taskInfo2.ॱ(downloadHistory.ʻ());
                    taskInfo2.ˎ(100);
                } else if (ˋ2 == 11) {
                    taskInfo2.ˏ(1);
                    taskInfo2.ॱ(1);
                } else if (ˋ2 == 10) {
                    taskInfo2.ˏ(1);
                    taskInfo2.ॱ(0);
                }
                hashMap.put(downloadHistory.ˋ(), taskInfo2);
            }
        }
        ॱ.ˋ(hashMap);
        Status status = new Status(0);
        status.ˏ(ॱ);
        o_dgz.ॱ(status);
    }

    public QueryTaskResponse ॱ() {
        return new QueryTaskResponse();
    }

    private void ॱ(DataHolder<QueryTaskIPCRequest> dataHolder) {
        LinkedHashMap linkedHashMap = new LinkedHashMap();
        linkedHashMap.put("mediaPkg", dataHolder.ˏ().ˋ());
        dgh.ˋ("380105", linkedHashMap);
    }
}
